<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <f:verbatim>
            <link href="./resources/css/layout.css" rel="stylesheet" type="text/css" />
            <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
        </f:verbatim>
        <title>Добавить новую дисцплину</title>
    </h:head>
    <h:body>
        <h1>Новая Дисциплина</h1>
        <h:form id="newDiscipline">
            <h:panelGrid id="dataPanel" columns="2">
                <h:outputLabel id ="facLabel" value="Факультет:"/>
                <h:selectOneMenu id="faculty" title="Выберите факультет из списка" value="#{addDisciplineBean.selectedFaculty}" styleClass="facultyCombo">
                    <f:validateRequired/>
                    <f:selectItems id="facultyList" value="#{addDisciplineBean.selectFaculties}"/>
                    <f:ajax event="change" render="department"/>
                </h:selectOneMenu>
                <h:outputLabel id ="depLabel" value="Кафедра:"/>
                <h:selectOneMenu id="department" title="Выберите кафедру из списка" value="#{addDisciplineBean.selectedDepartment}" styleClass="facultyCombo">
                    <f:validateRequired/>
                    <f:selectItems id="departmentList" value="#{addDisciplineBean.selectDepartments}"/>
                </h:selectOneMenu>
                <h:outputLabel id ="codeLabel" value="Код Дисциплины:"/>
                <h:inputText id="codeNumber" value="#{addDisciplineBean.code}">
                    <f:validateRequired/>
                    <f:validator validatorId="disciplineCodeNumberValidator" />
                </h:inputText>
                <h:outputLabel id ="disciplineLabel" value="Дисцплина:"/>
                <h:inputText id="disciplineName" value="#{addDisciplineBean.disciplineName}">
                    <f:validateRequired/>
                </h:inputText>
                <h:outputLabel id ="lecturesLabel" value="Лекции:"/>
                <h:selectBooleanCheckbox id="lectures" value="#{addDisciplineBean.lectures}"/>
                <h:outputLabel id ="practiceLabel" value="Практика:"/>
                <h:selectBooleanCheckbox id="practice" value="#{addDisciplineBean.practice}"/>
                <h:outputLabel id ="labsLabel" value="Лабораторные:"/>
                <h:selectBooleanCheckbox id="labs" value="#{addDisciplineBean.labs}"/>
                <h:outputLabel id ="quizLabel" value="Зачет:"/>
                <h:selectBooleanCheckbox id="quiz" value="#{addDisciplineBean.quiz}"/>
                <h:outputLabel id ="examLabel" value="Экзамен:"/>
                <h:selectBooleanCheckbox id="exam" value="#{addDisciplineBean.exam}"/>
                <h:outputLabel id ="courseProjectLabel" value="Курсовой:"/>
                <h:selectBooleanCheckbox id="courseProject" value="#{addDisciplineBean.courseProject}"/>
                <h:outputLabel id ="testLabel" value="Тестирование:"/>
                <h:selectBooleanCheckbox id="test" value="#{addDisciplineBean.test}"/>
            </h:panelGrid>
            <h:panelGrid id="specGrid" columns="3">
                <h:outputLabel id ="selectedSpecLabel" value="Выбраные специальности"/>
                <h:outputLabel/>
                <h:outputLabel id ="availableSpecLabel" value="Доступные специальности"/>
                
                <h:selectOneListbox id="selectedSpecList" value="#{addDisciplineBean.selectedSpecForUnselect}" size="5" styleClass="specialitiesList" title="Двойным щелчком добавьте нужную специальность">
                    <f:selectItems id="selectedSpec" value="#{addDisciplineBean.selectedSpecialities}"/>
                    <f:ajax event="change" render="availaleSpecList selectedSpecList"/>
                </h:selectOneListbox>
                <h:panelGrid>
                    <h:commandButton id="addSpecCmd" value="&lt;" actionListener="#{addDisciplineBean.addSpeciality}" immediate="true"/>
                    <h:commandButton id="rmSpecCmd" value="&gt;" actionListener="#{addDisciplineBean.removeSpeciality}" immediate="true"/>
                </h:panelGrid>
                <h:selectOneListbox id="availaleSpecList" value="#{addDisciplineBean.selectedSpecForSelect}" size="5" styleClass="specialitiesList" title="Двойным щелчком удалите нужную специальность">
                    <f:selectItems id="availableSpec" value="#{addDisciplineBean.availableSpecialities}"/>
                    <f:ajax event="change" render="availaleSpecList selectedSpecList"/>
                </h:selectOneListbox>
            </h:panelGrid>
            <h:message for="disciplineName codeNumber faculty department" style="color:red" />
            <h:commandButton id="Save" value="Сохранить" actionListener="#{addDisciplineBean.Save}" action="index.xhtml"/>
            <h:commandButton id="Cancel" value="Отмена" action="disciplines.xhtml" immediate="true"/>
        </h:form>
    </h:body>
</html>

